<template>
	<view class="all-main">
		<view class="mains">
			<view v-if="list && list.length > 0" class="total-detail">
				<view v-for="(item,index) in list" :key="index" class="items" @click="tradeDetail(item)">
					<view class="lefts">
						<view class="dates">
							{{item.day}}
						</view>
						<view class="totals">
							<text>交易总额：</text>
							<text>{{item.total_amount}}</text>
						</view>
					</view>
					<view class="rights">
						<u-icon name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sn: '',
				month: '',
				list: []
			}
		},
		onLoad(e) {
			this.sn = e.sn
			this.month = e.month
			this.loadData()
		},
		methods: {
			// 获取数据
			async loadData() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getMerchantMonthInfo',
					data: {
						sn: this.sn,
						month: this.month
					}
				});
				uni.hideLoading()
				if (res.code == 200) {
					this.list = res.data
				}
			},
			// 交易详情
			tradeDetail(item) {
				uni.navigateTo({
					url: '/pages/index/merchant/tradeDayDetail?sn=' + item.sn + '&day=' + item.day
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #F2F6FC;
	}
	.all-main {
		.mains {
			.total-detail {
				padding: 30rpx;
				.items {
					display: flex;
					justify-content: space-between;
					align-items: center;
					background-color: #ffffff;
					font-size: 24rpx;
					padding: 20rpx;
					border-radius: 16rpx;
					box-shadow: 0 0 16px -14px #333;
					margin-bottom: 30rpx;
					
					.lefts {
						.dates {
							padding-bottom: 10rpx;
						}
						
						.totals {
							color: #909399;
						}
					}
				}
			}
		}
	}
</style>
